package me.ereach.comparable;

public class User implements Comparable<User> {
    private String name;
    private String email;
    private String gender;
    private int age;

    public String getEmail() {
        return email;
    }

    public User(String name, String email, String gender, int age) {
        this.name = name;
        this.email = email;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString() {
        return "User { name: " + name + ", email: " + email + ", gender: " + gender + ", age: " + age + " }";
    }

    @Override
    public int compareTo(User o) {
        return this.age - o.age;
    }
}
